export function getFormItems(type:string, releaseInfo:any) {
    if (type === 'goods') {
        let tempItems = JSON.parse(JSON.stringify(items));
        tempItems.splice(4, 0, {
            key: "number_unit",
            label: "数量单位",
            placeholder: "请选择数量单位",
            type: "disabled",
            required: true,
            value: releaseInfo["number_unit"],
            rules: {},
            details: {
                type: "numberUnit"
            }
        })
        return tempItems
    } else if (type === 'transport') {
        let ret_transport = JSON.parse(JSON.stringify(items))
        if (releaseInfo.release_type === '1') {
            ret_transport[1].label = '整车运费'
            ret_transport[1].placeholder = '请输入整车运费'
            ret_transport.splice(1, 0, {
                key: "product_weight",
                label: "重量",
                placeholder: "请输入产品重量",
                type: "text",
                required: true,
                value: "",
                rules: {},
            }, {
                key: "product_volume",
                label: "体积",
                placeholder: "请输入产品体积",
                type: "text",
                required: true,
                value: "",
                rules: {},
            })
            ret_transport.splice(6, 0, {
                key: "product_address",
                label: "装货地址",
                placeholder: "请选择装货地址",
                type: "city",
                required: true,
                value: [],
                rules: {},
            })
        } else if (releaseInfo.release_type === '2') {
            ret_transport.splice(0, 1, {
                key: "car_category_id",
                label: "车型",
                placeholder: "请选择车型 >",
                type: "actionSheet",
                required: true,
                value: {
                    pid: 0,
                    value: 0,
                    text: '',
                    level: 1,
                    type: 'release_transport',
                },
                rules: {},
            })
            ret_transport.splice(1, 0, {
                key: "product_volume",
                label: "体积",
                placeholder: "请输入车辆体积",
                type: "text",
                required: true,
                value: "",
                rules: {},
            })
            ret_transport.splice(4, 1, {
                key: "product_weight",
                label: "重量",
                placeholder: "请输入重量",
                type: "text",
                required: true,
                value: "",
                rules: {},
            })
            ret_transport[2].label = '运费总价'
            ret_transport[2].placeholder = '请输入运费总价'

            ret_transport[6].label = '装货时间'
            ret_transport[6].placeholder = '请选择装货时间'
        } else {
            if (releaseInfo.human_type === '1') {
                //货源信息
                ret_transport[1].label = '运费'
                ret_transport[1].placeholder = '请输入运费'
                ret_transport.splice(3, 0, {
                    key: "product_weight",
                    label: "重量",
                    placeholder: "请输入重量",
                    type: "text",
                    required: true,
                    value: "",
                    rules: {},
                })
            } else {
                //我要带货
                ret_transport.splice(0, 1)
                ret_transport[0].label = '运费'
                ret_transport.splice(3, 0, {
                    key: "product_weight",
                    label: "重量",
                    placeholder: "请输入重量",
                    type: "text",
                    required: true,
                    value: "",
                    rules: {},
                })
                // ret_transport[2].placeholder = '请输入运费'
            }
        }
        return ret_transport
    } else if (type === 'crossborder') { // 跨境货代
        let ret_crossborder = JSON.parse(JSON.stringify(items))
        ret_crossborder.splice(0, 1)
        ret_crossborder[0].label = '费用总价'
        ret_crossborder[0].placeholder = '请输入费用总价'
        ret_crossborder.splice(2, 1)
        ret_crossborder[2].label = '时效' // 天
        ret_crossborder[2].placeholder = '请输入时效'
        return ret_crossborder
    } else if (type === 'professional') {
        let ret_professional = JSON.parse(JSON.stringify(items))
        ret_professional[0].label = '服务内容'
        ret_professional[0].placeholder = '请输入服务内容'
        ret_professional[1].label = '服务报价'
        ret_professional[1].placeholder = '请输入服务报价'
        ret_professional.splice(5, 1)
        ret_professional.splice(5, 1)
        ret_professional[4].label = '服务时长'
        ret_professional[4].placeholder = '请输入服务时长'
        return ret_professional
    }
}


let items = [{
    key: "product",
    label: "提供产品",
    placeholder: "请输入您能提供的产品",
    type: "text",
    required: true,
    value: "",
    rules: {},
},
{
    key: "price",
    label: "价格(单价)",
    placeholder: "请输入您能提供产品的价格",
    type: "number",
    required: true,
    value: "",
    rules: {},
},
{
    key: "price_unit",
    label: "单位",
    placeholder: "",
    type: "disabled",
    required: true,
    value: "元",
    rules: {},
    details: {
        type: "priceUnit"
    }
},
{
    key: "num",
    label: "数量",
    placeholder: "请输入您能提供产品的数量",
    type: "number",
    required: true,
    value: "",
    rules: {},
},
{
    key: "speed",
    label: "速度",
    placeholder: "请输入您能提供产品的速度",
    type: "number",
    required: true,
    value: "",
    rules: {},
},
{
    key: "send_time",
    label: "发货时间",
    placeholder: "请选择发货时间",
    type: "picker",
    required: true,
    value: "",
    rules: {},
},
// {
//   key: "reach_time",
//   label: "送达时间",
//   placeholder: "请选择送达时间",
//   type: "picker",
//   required: true,
//   value: "",
//   rules: {},
// },
{
    key: "is_margin",
    label: "是否缴纳保证金",
    placeholder: "",
    type: "radio",
    required: false,
    value: "2",
    rules: {},
},
{
    key: "margin_amount",
    label: "保证金金额",
    placeholder: "请输入金额",
    type: "disabled",
    required: false,
    value: "",
    rules: {},
},
{
    key: "images",
    label: "请上传图片",
    placeholder: "",
    type: "images",
    required: false,
    value: [],
    rules: {},
},
{
    key: "videos",
    label: "请上传视频",
    placeholder: "",
    type: "videos",
    required: false,
    value: [],
    rules: {},
},
{
    key: "files",
    label: "请上传文件",
    placeholder: "",
    type: "files",
    required: false,
    value: [],
    rules: {},
},
{
    key: "con",
    label: "详情",
    placeholder: "请输入详情内容",
    type: "textarea",
    required: false,
    value: "",
    rules: {},
}
]

export const formItems = [{
    key: "product",
    label: "提供产品",
    placeholder: "请输入您能提供的产品",
    type: "text",
    required: true,
    value: "",
    rules: {},
},
{
    key: "price",
    label: "价格(单价)",
    placeholder: "请输入您能提供产品的价格",
    type: "number",
    required: true,
    value: "",
    rules: {},
},
{
    key: "num",
    label: "数量",
    placeholder: "请输入您能提供产品的数量",
    type: "number",
    required: true,
    value: "",
    rules: {},
},
{
    key: "speed",
    label: "速度",
    placeholder: "请输入您能提供产品的速度",
    type: "number",
    required: true,
    value: "",
    rules: {},
},
{
    key: "send_time",
    label: "发货时间",
    placeholder: "请选择发货时间",
    type: "picker",
    required: true,
    value: "",
    rules: {},
},
// {
//   key: "reach_time",
//   label: "送达时间",
//   placeholder: "请选择送达时间",
//   type: "picker",
//   required: true,
//   value: "",
//   rules: {},
// },
{
    key: "is_margin",
    label: "是否缴纳保证金",
    placeholder: "",
    type: "radio",
    required: false,
    value: "2",
    rules: {},
},
{
    key: "margin_amount",
    label: "保证金金额",
    placeholder: "请输入金额",
    type: "disabled",
    required: false,
    value: "",
    rules: {},
},
{
    key: "images",
    label: "请上传图片",
    placeholder: "",
    type: "images",
    required: false,
    value: [],
    rules: {},
},
{
    key: "videos",
    label: "请上传视频",
    placeholder: "",
    type: "videos",
    required: false,
    value: [],
    rules: {},
},
{
    key: "files",
    label: "请上传文件",
    placeholder: "",
    type: "files",
    required: false,
    value: [],
    rules: {},
},
{
    key: "con",
    label: "详情",
    placeholder: "请输入详情内容",
    type: "textarea",
    required: false,
    value: "",
    rules: {},
}
]
